<%@ attribute name="id" required="true" %>
<%@ attribute name="cssClass" required="false" %>

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>

<img
    src="<c:url value="/viewImage.html" >
                <c:param name="id" value="${id}" />
          </c:url>" 
    <c:if test="${not empty cssClass}">class="${cssClass}"</c:if>
/>